<?php
define('_file_','a_add_modfiles');
if ( !isGod() )
	if ( !getRights($mod,'full') )
		if ( !News_getAccessFile(_file_) )
		{
			showMsg('Không có quyền truy cập vào trang này này !','ex','center');
			die();
		}
if ( @$_POST['cmdOK'] != '' )
{
	$fname = getVar('txtFName',false,true);
	$fdesc = getVar('txtFDesc',false,true);
	
	if ( empty($fname) || empty($fdesc) )
		showMsg('Dữ liệu không hợp lệ !','ex','center');
	else
	{
		$sql = "INSERT INTO mod_files(fname,fdesc,modname) VALUES('$fname','$fdesc','$mod')";
		$link->execute($sql);
		
		header("Location: admin.php?mod=$mod&act=a_list_modfiles");
	}
}
?>
<style type="text/css">
<!--
.style1 {
	font-family: Tahoma, verdana, arial;
	font-size: 11px;
	font-weight: bold;
	color: #FFFFFF;
}
-->
</style>
<script language="javascript">
function checkform()
{
	if ( document.all['txtFName'].value == '' )
	{
		alert('Chua nhap vao ten file !');
		document.all['txtFName'].focus();
		return false;
	}
	if ( document.all['txtFDesc'].value == '' )
	{
		alert('Chua nhap vao ten chức năng !');
		document.all['txtFDesc'].focus();
		return false;
	}	
	return true;
}
</script>
<form action="admin.php?mod=News&act=a_add_modfiles" method="post" name="frmAdd" id="frmAdd">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" style="border:1px solid #336699">
    <tr>
      <td height="30" bgcolor="#336699">&nbsp;<span class="style1">Thêm chức năng</span> </td>
    </tr>
    <tr>
      <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>Tên file </td>
            <td><input name="txtFName" type="text" id="txtFName" size="50" maxlength="50"></td>
          </tr>
          <tr>
            <td>Chức năng </td>
            <td><input name="txtFDesc" type="text" id="txtFDesc" size="50" maxlength="50"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="40" align="right" bgcolor="#000066"><input name="cmdOK" type="submit" value=" Thêm chức năng &raquo; ">
        &nbsp;</td>
    </tr>
  </table>
</form>